import { defineMongooseModel } from "#nuxt/mongoose";
export interface dataProps {
  name: string;
  EnglishName: string;
  desc: string;
  order: number;
  createdAt: string;
  updatedAt: string;
}
export const PositionSchema = defineMongooseModel<dataProps>(
  "Position",
  {
    name: { type: String, unique: true },
    EnglishName: { type: String, unique: true },
    desc: { type: String },
    order: { type: Number },
  },
  {
    timestamps: true,
    toJSON: {
      // 过滤掉敏感字段
      transform(doc: any, ret: Record<string, any>, options: any) {
        delete ret.__v;
      },
    },
  }
);
